<%@ page pageEncoding="utf-8" contentType="text/html" %>
<%@ page import="core.*, model.*" %>
<%CurrentUser user = new CurrentUser(request); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="plus-quiz" />
<meta name="description" content="Online Quiz System" />
<meta name="keywords" content="quiz,exam,question" />
<title>+Quiz System Online</title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" />
<script type="text/javascript" src="./js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script type="text/javascript">
var Config = {
	messageTimeout:<%=Config.messageTimeout%>
}
</script>
</head>

<body>
<div id="wrap">

<div id="header">
	<h2>+Quiz</h2>
	<%if(user.isLoggedIn()){%>
	<div id="profile" class="popupmenu">
		<div class="avatar"><img src="image/avatar.png"></div>
		<div id="profile_menu" class="popup">
			<div class="username"><%=user.getUsername()%></div>
			<ul class="vmenu">
				<li><a href="ChangeProfile">信息</a></li>
				<li><a href="UserFootprint">足迹</a></li>
				<li><a href="Logout">退出</a></li>
			</ul>
		</div>
	</div>
	<%}%>
	
		<ul id="nav">
			<li><a href="index.jsp">首页</a></li>
			<li id="nav_questions" class="popupmenu">
				<a href="QuestionList">题库</a>
				<ul id="nav_questions_menu" class="vmenu popup">
					<li><a href="QuestionList">题目列表</a></li>
					<li><a href="QuestionThriller">刷题机</a></li>
					<%if(user.getGroup().hasPermission(UserGroup.ADD_QUESTION)){%>
					<li><a href="EditQuestion">添加题目</a></li>
					<%}%>
					<li><a href="PaperList">套题</a></li>
				</ul>
			</li>
			<li><a href="RankList">排行榜</a></li>
			<li><a href="about.jsp">关于</a></li>
			<%if(user.getGroup().isAdministrator()){%>
			<li id="nav_cpanel" class="popupmenu">
				<a href="SystemConfig">后台</a>
				<ul id="nav_cpanel_menu" class="vmenu popup">
					<li><a href="SystemConfig">系统设置</a></li>
					<li><a href="EditUserGroup">用户组</a></li>
					<li><a href="UserList">用户</a></li>
				</ul>
			</li>
			<%}%>
		</ul>
	
</div>

<script type="text/javascript">
var index = true;
$('#nav a').each(function(){
	var current = this.href == location.href.substr(0, this.href.length);
	
	if(!current && typeof this.id == 'string' && this.id.length > 0){
		$('#' + this.id + '_menu a').each(function(){
			if(this.href == location.href.substr(0, this.href.length)){
				current = true;
				return false;
			}
		});
	}
	
	if(current){
		$(this).addClass('current');
		$(this).attr('href', '#');
		index = false;
		return false;
	}
});
if(index){
	$('#nav a:first').addClass('current');
}
</script>

<div id="main">
